import Vue from "vue";
import VueRouter from "vue-router";

//登录
import login from "@/views/login";
//首页
import index from "@/views/index";
//注册
import register from "@/views/register";

import demo from "@/views/demo"; //首页

/**
 *内部页面
 */
// common 公用
import home from "@/views/common/home"; //首页
import certified from "@/views/common/certified"; //认证
import setrole from "@/views/common/setrole"; //角色管理
import setstaff from "@/views/common/setstaff"; //员工管理
import setpassword from "@/views/common/setpassword"; //设置密码

// shipper 托运人，发货
import sendgoods from "@/views/shipper/sendgoods"; //发货
import oftenrace from "@/views/shipper/oftenrace"; //长跑路线
import order from "@/views/shipper/order"; //订单管理
import waybill from "@/views/shipper/waybill"; //运单管理
import orderledger from "@/views/shipper/orderledger"; //订单台账
import waybillledger from "@/views/shipper/waybillledger"; //运单台账

// carrier 承运人，收货
import drivermanage from "@/views/carrier/drivermanage"; //司机管理
import driverupload from "@/views/carrier/driverupload"; //司机认证
import carmanage from "@/views/carrier/carmanage"; //车辆管理
import carupload from "@/views/carrier/carupload"; //车辆认证
import carwrite from "@/views/carrier/carwrite"; //车辆填写认证


Vue.use(VueRouter);

const routes = [{
    path: '/',
    redirect: {
      name: 'login'
    }
  }, {
    path: "/demo",
    name: "demo",
    component: demo,
    meta: {
      requireAuth: false
    }
  },
  {
    path: "/login",
    name: "login",
    component: login,
    meta: {
      requireAuth: false
    }
  },
  {
    path: "/register",
    name: "register",
    component: register,
    meta: {
      requireAuth: false
    }
  },
  {
    path: "/index",
    name: "index",
    component: index,
    children: [
      // common 公用
      {
        path: "/home",
        name: "home",
        component: home,
        meta: {
          requireAuth: true
        }
      }, {
        path: "/certified",
        name: "certified",
        component: certified,
        meta: {
          requireAuth: true
        }
      }, {
        path: "/setrole",
        name: "setrole",
        component: setrole,
        meta: {
          requireAuth: true
        }
      }, {
        path: "/setstaff",
        name: "setstaff",
        component: setstaff,
        meta: {
          requireAuth: true
        }
      }, {
        path: "/setpassword",
        name: "setpassword",
        component: setpassword,
        meta: {
          requireAuth: true
        }
      },
      // shipper 托运人，发货
      {
        path: "/sendgoods",
        name: "sendgoods",
        component: sendgoods,
        meta: {
          requireAuth: true
        }
      },{
        path: "/oftenrace",
        name: "oftenrace",
        component: oftenrace,
        meta: {
          requireAuth: true
        }
      },{
        path: "/order",
        name: "order",
        component: order,
        meta: {
          requireAuth: true
        }
      },{
        path: "/waybill",
        name: "waybill",
        component: waybill,
        meta: {
          requireAuth: true
        }
      },{
        path: "/orderledger",
        name: "orderledger",
        component: orderledger,
        meta: {
          requireAuth: true
        }
      },{
        path: "/waybillledger",
        name: "waybillledger",
        component: waybillledger,
        meta: {
          requireAuth: true
        }
      },
      // carrier 承运人，收货
      {
        path: "/drivermanage",
        name: "drivermanage",
        component: drivermanage,
        meta: {
          requireAuth: true
        }
      }, {
        path: "/driverupload",
        name: "driverupload",
        component: driverupload,
        meta: {
          requireAuth: true
        }
      },{
        path: "/carmanage",
        name: "carmanage",
        component: carmanage,
        meta: {
          requireAuth: true
        }
      },{
        path: "/carupload",
        name: "carupload",
        component: carupload,
        meta: {
          requireAuth: true
        }
      },{
        path: "/carwrite",
        name: "carwrite",
        component: carwrite,
        meta: {
          requireAuth: true
        }
      },
    ]
  }
];

const router = new VueRouter({
  routes
});

export default router;